# $Id: PKGBUILD 89953 2013-05-06 07:54:59Z jelle $
# Maintainer: Thomas Dziedzic < gostrc at gmail >
# Contributor: Pierre Chapuis <catwell at archlinux dot us>

pkgname=('python-decorator' 'python2-decorator')
pkgver=3.4.0
pkgrel=1
pkgdesc='Python Decorator module'
arch=('any')
url='http://pypi.python.org/pypi/decorator'
license=('BSD')
makedepends=('python2' 'python' 'python-distribute')
source=("http://pypi.python.org/packages/source/d/decorator/decorator-${pkgver}.tar.gz"
        'LICENSE.txt')
md5sums=('1e8756f719d746e2fc0dd28b41251356'
         '0ca76d2c707f09dbb04acc425ea1a08b')

build() {
  # Make python and python2 builds possible
  cp -r decorator-$pkgver decorator2-$pkgver

  cd "$srcdir/decorator-$pkgver"

  python3 setup.py build

  cd "$srcdir/decorator2-$pkgver"

  python2 setup.py build
}

package_python2-decorator() {
depends=('python2')
replaces=('python-decorator<=3.3.2-1')
  cd "${srcdir}/decorator2-${pkgver}"

  python2 setup.py install --root="${pkgdir}" --optimize=1

  install -D -m644 "${srcdir}/LICENSE.txt" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
package_python-decorator() {
depends=('python')
  cd "${srcdir}/decorator-${pkgver}"

  python3 setup.py install --root="${pkgdir}" --optimize=1

  install -D -m644 "${srcdir}/LICENSE.txt" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
